<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/19
 * Time: 14:50
 */
//$arr = range(1,5);
$arr = [
    'a'=>1,
    'b'=>2,
    'c'=>3,
    'd'=>4,
    'e'=>5
];
var_dump($arr);
$brr = array_map(function($item){
//    var_dump(func_get_args());
    return $item*2;
},$arr);

var_dump($brr);
$brr = array_map(function($item){
//    var_dump(func_get_args());
    return $item*3;
},$arr);

var_dump($brr);


function my_map($callback,$arr){
    $tmp = [];
    foreach($arr as $k=>$v){
        $tmp[$k] = $callback($v);
    }
    return $tmp;
}

echo "<br>************<br>";
function X3($item){
    return $item*3;
}
$brr = my_map("X3",$arr);
var_dump($brr);